<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
    	<meta http-equiv="X-UA-Compatible" content="IE=edge">
    	<meta name="viewport" content="width=device-width, initial-scale=1">
		<title>用户列表</title>
		<link href="${pageContext.request.contextPath }/css/bootstrap.min.css" rel="stylesheet">
		<script type="text/javascript">
			function del(uid){
				if(confirm("确认要删除？")){
					window.location.href="${pageContext.request.contextPath }/userAdmin_delete.action?uid="+uid;
				}
			}
		</script>
	</head>
	<body>
		<div class="row">
			<div class="col-md-12">
				<div class="panel panel-default">
					<div class="panel-heading">用户列表</div>
					<div class="panel-body">
						<table class="table table-striped table-hover table-bordered">
							<thead>
								<tr>
									<th>#</th>
									<th>用户名</th>
									<td>邮箱</td>
									<td>状态</td>
									<td>编辑</td>
									<td>删除</td>
								</tr>
							</thead>
							<tbody>
								<s:iterator var="user" value="pageBean.list" status="st">
								<tr>
									<td><s:property value="#st.count"/></td>
									<td><s:property value="#user.username"/></td>
									<td><s:property value="#user.email"/></td>
									<td>
										<s:if test="#user.state == 1">已激活</s:if>
										<s:else>未激活</s:else>
									</td>
									<td>
										<a href="${pageContext.request.contextPath }/userAdmin_edit.action?uid=<s:property value="#user.uid"/>"><span class="glyphicon glyphicon-pencil"></span></a>
									</td>
									<td>
										<a href="javascript:del(<s:property value="#user.uid"/>)"><span class="glyphicon glyphicon-remove"></span></a>
									</td>
								</tr>
								</s:iterator>
							</tbody>
						</table>
					</div>
				</div>
			</div>
		</div>
		<nav aria-label="Page navigation" class="pull-right">
		  <ul class="pagination" style="margin-top: 5px;">
		  		<s:if test="pageBean.page != 1">
				<li>
				  <a href="${pageContext.request.contextPath }/userAdmin_findAllWithPage?page=<s:property value="pageBean.page-1"/>" aria-label="Previous">
					<span aria-hidden="true">上一页</span>
				  </a>
				</li>
				</s:if>
				<s:iterator var="i" begin="1" end="pageBean.totalPage">
					<s:if test="pageBean.page != #i">
						<li><a href="${pageContext.request.contextPath }/userAdmin_findAllWithPage?page=<s:property value="#i"/>"><s:property value="#i"/></a></li>
					</s:if>
					<s:else>
						<li class="active"><a href="#"><s:property value="#i"/></a></li>
					</s:else>
				</s:iterator>
				<s:if test="pageBean.page != pageBean.totalPage">
				<li>
				  <a href="${pageContext.request.contextPath }/userAdmin_findAllWithPage?page=<s:property value="pageBean.page+1"/>" aria-label="Next">
						<span aria-hidden="true">下一页</span>
				  </a>
				</li>
				</s:if>
		  </ul>
		</nav>
	</body>
</html>


